package http

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/liyaozong/mengo/common/di"
	"github.com/liyaozong/mengo/contracts/dtos/responses"
	"github.com/liyaozong/mengo/contracts/models"
)

type AuthController struct {
	dic         *di.Container
	serviceName string
}

func NewAuthController(dic *di.Container, serviceName string) *AuthController {
	return &AuthController{
		dic:         dic,
		serviceName: serviceName,
	}
}

func (u *AuthController) Login(ctx *gin.Context) {
	user := models.User{
		Name:     "yaozong",
		Username: "admin",
		Status:   1,
		Lang:     "zh-CN",
		RoleId:   "admin",
		Token:    "4291d7da9005377ec9aec4a71ea837f",
	}
	response := responses.NewLoginResponse("", "成功", 0, user)
	ctx.JSON(http.StatusOK, response)
}

func (a *AuthController) Logout(ctx *gin.Context) {
	ctx.JSON(http.StatusOK, nil)
}

func (u *AuthController) TwoStepCode(ctx *gin.Context) {
	response := responses.TwoStepCodeResponse{
		Code: models.TwoStepCode{
			StepCode: 0,
		},
	}
	ctx.JSON(http.StatusOK, response)
}
